<template>
  <div id="box" >
    box
  </div>
  <el-button type="primary" @click="add()">add</el-button>
</template>

<script lang="ts" setup>
const add = ()=>{
  var li = '<span>测试</span>';
  document.querySelector('#box')?.insertAdjacentHTML('beforeend', li);
  Promise.resolve().then(()=>alert('微任务:dom渲染前执行'))
  setTimeout(()=>{
    alert('宏任务:dom渲染后执行')
  })
}
</script>
